/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/

#ifndef MAP_HANDLING_H
#define MAP_HANDLING_H

#ifndef PI
	#define PI	3.141592654
#endif

#ifndef LOCALMAPSIZE 
	#define LOCALMAPSIZE 25.0
#endif


void getMapLines(float *map, int M, int N, float *lines);

TLineVector readMapDataFromFile(const char *fileName,float scale);
int saveMapDataToFile(TLineVector LV, const char *fileName,float scale);

int isCloseToEndPoints(TPose point, TLine Line);
TLineVector getLocalMap(TPose pos,TLineVector map);
TLineVector handleCadMap(TLineVector cadMap);
int isParametersExcactlySame(TLine l1,TLine l2);

/**
 * Inserts map points cMap.
 * 
 * @param cMap map where to add new lines.
 * @param map new lines, 4 points(x1, y1, x2, y2)
 * @param map_size, map array size is 4*map_size
 * @return 0 if all ok, else -1.
 */
int addLinesToMap(TLineVector *cMap, float *map, int map_size);

#endif //MAP_HANDLING_H
